<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('货币信息'); ?></h5></li>
                <li class="active"><a data-toggle="tab" href="#user_a"><?php echo $this->translate('基本信息'); ?></a></li>
              </ul>
              <form class="form-horizontal" name="currency_form" id="currency_form" method="post" action="">
              <input type="hidden" name="currency_id" id="currency_id" value="<?php if($this->currency_info) echo $this->currency_info->currency_id; else echo ''; ?>" />
              <div class="tab-content">
    			<div style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->currency_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('货币'); ?></strong></div>
        			<div class="pull-right">
                	<a href="<?php echo $this->url('currency/default',array('action'=>'index')); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回货币列表'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->currency_info and $this->currency_info->currency_id != 1) { ?>
                    <a href="javascript:;" onclick="return currency_del_js(<?php echo $this->currency_info->currency_id ?>);" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除货币'); ?></a>&nbsp;
                    <?php } ?>
                	<button type="submit" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存货币信息'); ?></button>&nbsp;
                	<a href="<?php echo $this->myviewalias()->dbshopHelpUrl('currency_set'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                	</div>
        		</div>
                <div id="user_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well"> 
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币选择'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              				<select id="currency_code" name="currency_code" class="currency-select">
                            <?php if ($this->currency_array['currency']) foreach($this->currency_array['currency'] as $currency_value) { ?>
                            <option value="<?php echo $currency_value['type']; ?>" <?php if($this->currency_info and $this->currency_info->currency_code == $currency_value['type']) echo 'selected="selected"'; ?>><?php echo (is_array($currency_value['displayName']) ? $currency_value['displayName'][0] : $currency_value['displayName']); ?></option>
                            <?php } ?>
                            </select>
            				</div>                        
                        </div>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('货币名称'); ?><span class="must_add_value">*</span>：</label>
                            <div class="controls">
                                <input type="text" id="currency_name"  name="currency_name" value="<?php echo ($this->currency_info ? $this->currency_info->currency_name : ''); ?>" class="span4">
                            </div>
                        </div>
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币符号'); ?>：</label>
           					<div class="controls">
              				<input type="text" id="currency_symbol"  name="currency_symbol" value="<?php echo ($this->currency_info ? $this->currency_info->currency_symbol : ''); ?>" class="span4">	
            				</div>                        
                        </div>                    	
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币单位'); ?>：</label>
           					<div class="controls">
              				<input type="text" id="currency_unit"  name="currency_unit" value="<?php echo ($this->currency_info ? $this->currency_info->currency_unit : ''); ?>" class="span4">	
            				</div>                        
                        </div>                        
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('小数位数'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              				<input type="text" id="currency_decimal"  name="currency_decimal" value="<?php echo ($this->currency_info ? $this->currency_info->currency_decimal : ''); ?>" class="span4">	
            				</div>                        
                        </div>                        
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币汇率'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              				<input type="text" id="currency_rate"  name="currency_rate" <?php if($this->currency_info and $this->currency_info->currency_id == 1) echo 'readonly="readonly"'; ?>  value="<?php echo ($this->currency_info ? $this->currency_info->currency_rate : ''); ?>" class="span4"> <i class="cus-help shop_admin_help_note" data-content="<?php echo $this->translate('相对于基础货币, 假如基础货币是人民币，添加货币 美元，假定 人民币:美元 为 0.142857，那么货币美元的汇率即为 0.142857'); ?>"></i>	
            				</div>                        
                        </div> 
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币类型'); ?>：</label>
           					<div class="controls">
              				<?php echo (($this->currency_info and $this->currency_info->currency_type=='1') ? $this->translate('基础货币') : $this->translate('非基础货币')); ?>
            				</div>                        
                        </div>                        
                        <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('货币状态'); ?>：</label>
           					<div class="controls">
           					    <?php if (isset($this->currency_info) and $this->currency_info->currency_id == 1) {
           					        echo $this->translate('启用');
           					        ?>
           					    <INPUT type="hidden" name="currency_state" id="currency_state" value="1">
           					    <?php } else { ?>
              					<select id="currency_state" name="currency_state" class="span2">
                                <option value="1" <?php if($this->currency_info and $this->currency_info->currency_state == 1) echo 'selected="selected"'; ?>><?php echo $this->translate('启用'); ?></option>
                                <option value="0" <?php if($this->currency_info and $this->currency_info->currency_state == 0) echo 'selected="selected"'; ?>><?php echo $this->translate('禁用'); ?></option>
                                </select>
                                <?php }?>	
            				</div>                        
                        </div>                                                                                                                       
                  	</div>
                </div>
             </div>
              </form>
</div>
<link href="<?php echo $this->basePath('public/js/chosen/chosen.css'); ?>" rel="stylesheet">
<script src="<?php echo $this->basePath('public/js/chosen/chosen.jquery.js'); ?>"></script>
<script>
$(document).ready(function() {
	$("#currency_form").validate({
		rules: {
            currency_name: {
                required: true
            },
			currency_decimal: {
				required: true,
				digits: true,
				min:0,
				max:6
			},
			currency_rate: {
				required: true,
				number: true,
				min:0,
				maxlength:10					
			}
		},
		messages: {
            currency_name: {
                required: "<?php echo $this->translate('货币名称不能为空！'); ?>"
            },
			currency_decimal: {
				required: "<?php echo $this->translate('小数位数不能为空！'); ?>",
				digits: "<?php echo $this->translate('小数位数必须为数字！'); ?>",
				min:"<?php echo $this->translate('位数最小为0！'); ?>",
				max:"<?php echo $this->translate('位数最大为6！'); ?>"
			},
			currency_rate: {
				required: "<?php echo $this->translate('货币汇率不能为空！'); ?>",
				number: "<?php echo $this->translate('货币汇率必须为数字！'); ?>",
				min: "<?php echo $this->translate('货币汇率最小为0！'); ?>",
				maxlength:"<?php echo $this->translate('货币汇率最长为10位！'); ?>"					
			}
		}
	});
	$(".currency-select").chosen();
});
//货币删除js
function currency_del_js(currency_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该货币吗？'); ?>')) {
	$.post("<?php echo $this->url('currency/default',array('action'=>'del','controller'=>'currency')); ?>",{currency_id:currency_id},
	function(data){
		if(data != 'false') {
			window.location.href='<?php echo $this->url('currency/default',array('action'=>'index','controller'=>'currency')); ?>';
			return true;
		} else {
			alert('<?php echo $this->translate('货币删除失败！'); ?>');
		}
	});
	}
	return false;
}
</script>